﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Infrastructure.Data.Core;
using Cesave.Domain.PermisosModule.Contracts.Areas;
using Cesave.Infrastructure.Data.PermisosModule.Context;
using Cesave.Infrastructure.CrossCutting.Logging;

namespace Cesave.Infrastructure.Data.PermisosModule.Repositories
{
	/// <summary>
	/// 
	/// </summary>
	public class AreaRepository
		: GenericRepositoryEx<Area>, IAreaRepository
	{

		public AreaRepository(IPermisosModuleContext context, ITraceManager traceManager)
			: base(context, traceManager)
		{
		}

		#region IAreaRepository Members
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="specification"></param>
		/// <returns></returns>
		public IEnumerable<Area> FindAreasByJunta(AreasByJuntaSpecification specification)
		{
			if (null == specification)
				throw new ArgumentNullException("specification");
			return GetBySpec(specification).OrderBy(a => a.Nombre);
		}

		#endregion
	}
}